<?php 

require_once('getconfig.php');

Class Model_typeofbusiness extends Dbo_DbManager
 {

	protected $N_CODE;
	protected $C_TYPEOFBUSINESS;
	protected $N_MEMBERSCOUNT;
	

 	public function __construct($bolCon=TRUE) {
		parent::__construct($bolCon);
	}
	
	public function getTypeofbusiness()
	{
		return  $this->C_TYPEOFBUSINESS;
	}
	
	public function getMemberscount()
	{
		return  $this->N_MEMBERSCOUNT;
	}		

	public function setTypeofbusiness($C_TYPEOFBUSINESS)
	{
		$this->C_TYPEOFBUSINESS=$C_TYPEOFBUSINESS;
	}
	
	public function setMemberscount($N_MEMBERSCOUNT)
	{
		$this->N_MEMBERSCOUNT=$N_MEMBERSCOUNT;
	}		

	public function write()
	{
		$objDbManager = new Dbo_DbManager();
		return $objDbManager->write($this,FALSE);
	}
	public static function delete($intproductid)
	{
		$objDbManager = new Dbo_DbManager();
		return $objDbManager->remove($intproductid,__CLASS__);
	}

	public static function build(array $arrModel_typeofbusiness)
	{
		$objModel_typeofbusiness = new Model_typeofbusiness(FALSE);
		@$objModel_typeofbusiness->setTypeofbusiness($arrModel_typeofbusiness['C_TYPEOFBUSINESS']);
		@$objModel_typeofbusiness->setMemberscount($arrModel_typeofbusiness['N_MEMBERSCOUNT']);

		return $objModel_typeofbusiness;
 	 } 	 
    
     public static function get_Typeofbusiness(){
		$arrRes=array();
		$objDbManager = new Dbo_DbManager ();
		$qry="select * from typeofbusiness order by C_TYPEOFBUSINESS ";
		$arrModel_User=$objDbManager->runquery("$qry");
		if (count( $arrModel_User ) > 0) {
			foreach ( $arrModel_User as $arrNew ) {
				$objUser = self::build ( $arrNew );
				$arrRes [] = $objUser;
			}
		}
		return $arrRes;
	}
	
     public static function get_Memberscount($typeofbusiness){
		$arrRes=array();
		$objDbManager = new Dbo_DbManager ();
		$qry="select N_MEMBERSCOUNT from typeofbusiness where C_TYPEOFBUSINESS='$typeofbusiness' ";
		$arrModel_User=$objDbManager->runquery("$qry");
		if (count( $arrModel_User ) > 0) {
			foreach ( $arrModel_User as $arrNew ) {
				$objUser = self::build ( $arrNew );
				$arrRes [] = $objUser;
			}
		}
		return $arrRes;
	}	

 }
 ?>